MultiDate Algorithm
Replaces the original date with a new modified date based on the original date value. A date period is used when generating a new modified date. The supported date periods are MONTH, QUARTER, HALF_YEAR, and YEAR. The MultiDate algorithm supports three different modes of operation, DISCRETE, SHIFT, and VARIABLE. Each mode controls how the modified date is generated within the given date period. The MultiDate algorithm supports both dates represented as strings and date objects. When masking string dates, the format needed to parse string date and to format dates needs to be specified
Algorithm Characteristics
- Algorithm: MultiDate
- Masking Technique: Anonymization
- Supported Types: String, Date (java.time.LocalDate, java.sql.Date)
- Referential Integrity: true
- Conflict-free: false
- Realistic Data: true
- Reversible: false
Properties
-
period {
enum
; optional; default:MONTH
}
One ofMONTH
,QUARTER
,HALF_YEAR
, orYEAR
. When using theMONTH
period, dates generated are within the same month as the original date. When using theQUARTER
period, dates generated are within the same quarter as the original date. When using theHALF_YEAR
period, dates generated are within the same half of the year as the original date. When using theYEAR
period, dates generated are within the same year as the original date.
Example:"period": "YEAR"
-
type {
enum
; optional; default:VARIABLE
}
One ofDISCRETE
,SHIFT
, orVARIABLE
. A masker of typeDISCRETE
uses the value of the discrete property to set the day with in the date period. A masker of typeSHIFT
uses the value of the shiftAmt property to shift the date +/- by the specified number of days in the date period. A masker of typeVARIABLE
shifts the date +/- by a variable but deterministic number of days in the dte period.
Example:"type": "DISCRETE"
-
discrete {
int
; optional; default: 15 }
When mode isDISCRETE
, the value if the discrete property is used to set the day within the period. The date is the discrete value day of the period. For instance, with an original date of 1/31/1999, if the period isMONTH
and the discrete value of15
, the masked date is 1/15/1999. With a periodQUARTER
and a discrete value of 45, the masked date is 2/14/1999 (45th day of the 1st quarter). If the discrete value is greater than the length of the period, then the value modulo the length of the period is used.
Example:"discrete": 5
-
shiftAmt {
int
; optional; default: 15 }
When mode isSHIFT
, the value of the shiftAmt property is to adjust the day within the period. The new day is determined by adding the shiftAmt value to the current day. For instance with an original date 1/15/1999, if the period isMONTH
and the shiftAmt is 7, then the masked date is 1/22/1999. With a periodQUARTER
and a shiftAmt value of 30, the masked date is 2/14/1999. if the day + shiftAmt is greater than the length of the period, then the day + shiftAmt modulo the length of the period is used.
Example:"shiftAmt": 30
-
inFormat {
string
; optional; default: "M/d/yyyy" }
The inFormat property specifies the DateTimeFormatter Patterns for Parsing the original date strings. The strings"BASIC_ISO_DATE"
,"ISO_LOCAL_DATE"
,"ISO_DATE"
,"ISO_ORDINAL_DATE"
, and"ISO_WEEK_DATE"
can be used instead of a pattern to select a DateTimeFormatter Predefined Formatter. If the supplied date strings do not match the pattern, a masking error will occur.
Example Pattern:"outFormat": "MM/dd/yyyy"
Example Formatter:"outFormat": "ISO_DATE"
-
outFormat {
string
; optional; default: inFormat-pattern }
The outFormat property specifies the DateTimeFormatter Patterns for Formatting the original date strings. The strings"BASIC_ISO_DATE"
,"ISO_LOCAL_DATE"
,"ISO_DATE"
,"ISO_ORDINAL_DATE"
, and"ISO_WEEK_DATE"
can be used instead of a pattern to select a DateTimeFormatter Predefined Formatter.
Example Pattern:"outFormat": "MM/dd/yyyy"
Example Formatter:"outFormat": "ISO_DATE"
Example JSON configuration
{
"name": "ExampleDateMasker",
"description": "Replaces a date by shifting it 10 days within the month.",
"algorithm": "MultiDate",
"type": "SHIFT",
"shiftAmt": 10,
"inFormat": "dd MMM yyyy",
"outFormat": "ISO_LOCAL_DATE"
}